package cc.catface.api.biz;

import cc.catface.common.aspect.NetLog;
import cc.catface.common.output.Result;
import cc.catface.dao.biz.app.dto.*;
import cc.catface.service.ApBehaviorServiceImpl;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@ApiSupport(order = 10)
@Api(tags = "[ap]用户行为")
@RestController
@RequestMapping("ap/behavior")
public class ApBehaviorController {
    @Autowired
    private ApBehaviorServiceImpl apBehaviorService;

    @ApiOperationSupport(order = 5)
    @NetLog("分享")
    @ApiOperation(value = "分享=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = ShareOUTDTO.class))
    @PostMapping("share")
    public Result<ShareOUTDTO> share(@RequestBody ShareINDTO in) {
        return apBehaviorService.share(in);
    }

    @ApiOperationSupport(order = 10)
    @NetLog("收藏")
    @ApiOperation(value = "收藏=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = CollectOUTDTO.class))
    @PostMapping("collect")
    public Result<CollectOUTDTO> collect(@RequestBody CollectINDTO in) {
        return apBehaviorService.collect(in);
    }

    @ApiOperationSupport(order = 11)
    @NetLog("取消收藏")
    @ApiOperation(value = "取消收藏=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = DisCollectOUTDTO.class))
    @PostMapping("disCollect")
    public Result<DisCollectOUTDTO> disCollect(@RequestBody DisCollectINDTO in) {
        return apBehaviorService.disCollect(in);
    }

    @ApiOperationSupport(order = 15)
    @NetLog("查看收藏列表")
    @ApiOperation(value = "查看收藏列表=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = ListCollectOUTDTO.class))
    @PostMapping("listCollect")
    public Result<List<ListCollectOUTDTO>> listCollect(@RequestBody ListCollectINDTO in) {
        return apBehaviorService.listCollect(in);
    }

    @ApiOperationSupport(order = 20)
    @NetLog("点赞")
    @ApiOperation(value = "点赞=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = LikeOUTDTO.class))
    @PostMapping("like")
    public Result<LikeOUTDTO> like(@RequestBody LikeINDTO in) {
        return apBehaviorService.like(in);
    }

    @ApiOperationSupport(order = 50)
    @NetLog("评论")
    @ApiOperation(value = "评论=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = CommentOUTDTO.class))
    @PostMapping("comment")
    public Result<CommentOUTDTO> comment(@RequestBody CommentINDTO in) {
        return apBehaviorService.comment(in);
    }

    @ApiOperationSupport(order = 51)
    @NetLog("删除评论")
    @ApiOperation(value = "删除评论=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = DeleteCommentOUTDTO.class))
    @PostMapping("deleteComment")
    public Result<DeleteCommentOUTDTO> deleteComment(@RequestBody DeleteCommentINDTO in) {
        return apBehaviorService.deleteComment(in);
    }

    @ApiOperationSupport(order = 52)
    @NetLog("评论回复")
    @ApiOperation(value = "评论回复=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = CommentRepayOUTDTO.class))
    @PostMapping("commentRepay")
    public Result<CommentRepayOUTDTO> commentRepay(@RequestBody CommentRepayINDTO in) {
        return apBehaviorService.commentRepay(in);
    }

    @ApiOperationSupport(order = 53)
    @NetLog("删除评论回复")
    @ApiOperation(value = "删除评论回复=开发完成")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = DeleteCommentRepayOUTDTO.class))
    @PostMapping("deleteCommentRepay")
    public Result<DeleteCommentRepayOUTDTO> deleteCommentRepay(@RequestBody DeleteCommentRepayINDTO in) {
        return apBehaviorService.deleteCommentRepay(in);
    }


}
